package com.fat.validation;

import com.fat.anno.State;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

import java.util.Objects;

public class StateValidator implements ConstraintValidator<State,String> {
    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        //提供校验规则
        if(Objects.isNull(s)){
            return  false;
        }
        return s.equals("已发布") || s.equals("草稿");
    }
}
